#include"list.h"

using namespace std;

template<class T>
void print(const dan::list<T>& lt)
{
	//typename dan::list<T>::iterator it = lt.begin();
	auto it = lt.begin();
	while (it != lt.end())
	{
		cout << *it << ' ';
		++it;
	}
	cout << endl;
}

struct Pos
{
	int _row;
	int _col;
	Pos(int row=0,int col=0):_row(row),_col(col){}
	
};
void test0()
{
	dan::list<Pos> lt1;
	lt1.push_back({ 1,1 });
	lt1.push_back({ 2,2 });
	lt1.push_back({ 3,3 });
	lt1.push_back({ 4,4 });
	
	auto it = lt1.begin();
	while (it != lt1.end())
	{
		cout << (*it)._col << ':'<<(*it)._row;

		//cout << it->->_col << ':' << it->->_row;
		cout << it->_col << ':' << it->_row;
		++it;
	}
	cout << endl;
	

}

void test01()
{
	dan::list<int> lt1;
	lt1.push_back(1);
	lt1.push_back(2);
	lt1.push_back(3);
	lt1.push_back(4);
	print(lt1);

	//lt1.push_front(10);
	//lt1.push_front(20);
	//print(lt1);

	//lt1.pop_back();
	//lt1.pop_back();
	//print(lt1);

	//lt1.pop_front();
	//lt1.pop_front();
	//print(lt1);

	auto lt2(lt1);
	print(lt2);

	dan::list<int> lt3= {1, 2, 3, 4, 5};
	print(lt3);
	lt2 = lt3;
	print(lt2);

}


int main()
{
	test01();

	return 0;
}